package com.pocket.demo.base.system;

import jakarta.annotation.PostConstruct;
import lombok.Getter;
import lombok.Setter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

/**
 * 系统信息 【demo-custom-props-2】
 */
@Setter
@Getter
@Component
@PropertySource("classpath:pocket.properties")
@ConfigurationProperties(prefix = "application")
public class PocketSystemInfo {

    private Logger logger = LoggerFactory.getLogger(getClass());

    private String copyRight;

    public static String serverHostName;

    public static String serverIp;

    public static Integer serverPort;

    @Override
    public String toString() {
        return "PocketSystemInfo{ " +
                "copyRight='" + copyRight + '\'' +
                " }";
    }

    @PostConstruct
    public void print(){
        logger.debug("系统配置信息：{}", toString());
    }
}
